package com.cqhfan.api.clients.user;

import com.cqhfan.api.clients.user.fallback.UserClientFallbackFactory;
import com.cqhfan.pojo.user.po.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 眭传洪
 * @create 2025-07-26 2:33
 */
@FeignClient(contextId = "user", value = "user-service", fallbackFactory = UserClientFallbackFactory.class)
public interface UserClient {

    @GetMapping("/user/getByUserName/{userName}")
    User getByUserName(@PathVariable("userName") String userName);

    @GetMapping("/user/getByPhone/{phone}")
    User getByUserPhone(@PathVariable("phone") String phone);

    @PostMapping("/user/save")
    Long save(@RequestBody User user);

    @GetMapping("/user/listByIds")
    List<User> listByIds(@RequestParam("userIds") Iterable<Long> userIds);

}
